﻿using System;

/*
 * Write an expression that checks for given point (x, y) if it is within the circle K( (1,1), 3)
 * and out of the rectangle R(top=1, left=-1, width=6, height=2).
 */

namespace _9_IsAPointWithinACoplexArea
{
    class IsAPointWithinACoplexArea
    {
        static void Main(string[] args)
        {
            double pointX = 0;
            double pointY = 0;
            
            double circleRadius = 3.0;
            double circleCenterX = 1.0;
            double circleCenterY = 1.0;

            double rectancleWidth = 6.0;
            double rectancleHeight = 2.0;
            double rectancleTopWall = 1.0;
            double rectancleLeftWall = -1.0;
            double rectancleRightWall = rectancleLeftWall + rectancleWidth;
            double rectancleBottomWall = rectancleTopWall - rectancleHeight;

            bool isAPointWithinACircle = (Math.Pow(pointX - circleCenterX, 2) + Math.Pow(pointY - circleCenterY, 2)) < Math.Pow(circleRadius,2);
            bool isAPointWithinARectangle = (pointX > rectancleLeftWall && pointX < rectancleRightWall) && (pointY < rectancleTopWall && pointY > rectancleBottomWall);
            bool isAPointWithinAComplexArea = isAPointWithinACircle && isAPointWithinARectangle;

            Console.WriteLine("The point[ {0} ; {1} ] is within the the complex area: {2}", pointX, pointY, isAPointWithinAComplexArea);
        }
    }
}
